package jp.sourceforge.akjrcp.videotools.subtitlemaker;

import jp.sourceforge.akjrcp.ui.draw2d.FileImageCache;
import jp.sourceforge.akjrcp.util.TimeUtils;

import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;

public class SubtitleFigureChecker extends AbstractImageChecker{
	FileImageCache imageCacher;
	int width=240;
	int height=180;
	public SubtitleFigureChecker(FileImageCache imageCacher,ThumbnailPreference preference,Shell shell,SelectableFigureList parentFigure) {
		super(preference,shell);
		this.parentFigure=parentFigure;
		this.imageCacher=imageCacher;
	}

	@Override
	public Figure createFigure(String fileName, Image img, long millisecond) {

		ThumbnailFigure figure=new ThumbnailFigure(fileName,imageCacher,width,height);
		figure.setData(millisecond);
		
		String label=TimeUtils.toTimeText(millisecond, false, true, true, true);
		
		Label l=new Label(label);
		l.setOpaque(true);
		figure.add(l,new Rectangle(2,2,100,10));
	
		return figure;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

}
